import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/Home.vue'),
    meta: { 
      title: '首页',
      breadcrumb: ['首页']
    }
  },
  {
    path: '/user',
    name: 'User',
    redirect: '/user/list',
    meta: { 
      title: '用户管理',
      breadcrumb: ['首页', '用户管理']
    },
    children: [
      {
        path: 'list',
        name: 'UserList',
        component: () => import('../views/UserList.vue'),
        meta: { 
          title: '用户列表',
          breadcrumb: ['首页', '用户管理', '用户列表']
        }
      }
    ]
  },
  {
    path: '/permission',
    name: 'Permission',
    redirect: '/permission/list',
    meta: { 
      title: '权限管理',
      breadcrumb: ['首页', '权限管理']
    },
    children: [
      {
        path: 'list',
        name: 'PermissionList',
        component: () => import('../views/PermissionList.vue'),
        meta: { 
          title: '权限列表',
          breadcrumb: ['首页', '权限管理', '权限列表']
        }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router